package router

import (
	"github.com/facebookgo/inject"
	"github.com/teambition/gear"
	"jgt-oper/src/context"
	"jgt-oper/src/web"
)

// WebEEMap 门禁设备管理相关路由
func WebEEMap(g *inject.Graph, r *gear.Router) {
	a := new(web.DeviceController)
	err := g.Provide(&inject.Object{Value: a})
	if err != nil {
		panic(err)
	}

	//查询按钮发出的请求 和 翻页点击时的发出请求
	r.Get("/entrance-equipment/page", context.WrapContext(a.QueryPage))
	//点击操作-编辑具体企业信息的时候发出的请求
	r.Get("/entrance-equipment/detail/:id", context.WrapContext(a.GetDetailCard))
	//入驻企业中点击保存发出的请求
	r.Post("/entrance-equipment", context.WrapContext(a.Create))
	//点击操作-编辑-保存的时候进行更新企业信息的时候 发出的请求
	r.Put("/entrance-equipment/:id", context.WrapContext(a.Update))

	//点击操作中迁出按钮发出的请求
	r.Patch("/entrance-equipment/remove/:id", context.WrapContext(a.Delete))

	//r.Get("/entrance-equipment/select", context.WrapContext(a.QuerySelect))
	r.Get("/entrance-equipment/tree-node", context.WrapContext(a.QueryTreeNode))

	r.Get("/entrance-equipment/get-equipment/:id", context.WrapContext(a.GetEquipmentInfo))
}
